<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>opp</title>
    </head>

<body>
<?php
/**php知识点练习**/
class ShopProduct {
	private $cost = 100;
	public $name = 'BB';
	public $price = 200;
	protected $sell = 2;


/**定义构造方法，通常用来进行对象初始化工作**/

public function_contruct($name=,$price,$cost ,$sell)
	{
		$this->name =  $name;
		$this->cost = $cost;
		$this->price = $price ;
		$this->sell = $sell ;

	}
	/**定义方法**/
	public function display($name,$price,$cost,$sell)
	{
		return $this->name.'的价格是：'. this->price;
	}
}

//定义书籍类
/**
 * 书籍类
 */
classBook extends ShopProduct{
	public $author =' ';
	public $version =' ';
	public $press =' ';

	function__construct($name='',$price='0',$cost = '0',$sell = '0',$author =' ',$version =' ',$press =' ')
	}

/**对象的生成**/
$p1 = new ShopProduct();
$p2 = new ShopProduct('小米6'，2999,2000,2000);
var_dump( $p2->cost );
var_dump( $p2->price );
var_dump( $p2->name );
var_dump( $p2->sell);

$p3=new Book('PHP核心语法',30.00,3.0,100,'john',1)
var_dump( $p3->name);
var_dump( $p3->price);
var_dump( $p3->cost);
var_dump( $p3->sell);
var_dump( $p3->author);
var_dump( $p3->version);
var_dump( $p3->press);

/**访问类的属性**/
echo '<pre>';
var_dump($r,$query);
echo '</pre>';
?>

</body>

</html>